package main

import (
	"fmt"
	"os"

	"gitee.com/libbylg/pkgr/repo"
)

// CmdDecode 编码
// pkgr decode token
func CmdDecode(argv []string) int {
	if len(argv) != 3 {
		ERROR("Missing parameters, try -h help")
		return 1
	}

	result, err := repo.TokenDecode(argv[2])
	if err != nil {
		ERROR("Invalid token: %v", err)
		return 1
	}

	fmt.Fprintf(os.Stdout, "%v", result)

	return 0
}
